#ifndef INSTANCEHOLDER_H
#define INSTANCEHOLDER_H

#include <QObject>
#include <QHash>
#include <QScriptEngine>
#include <QMetaProperty>
#include "libloader.h"


class InstanceHolder : public QObject
{
    Q_OBJECT
public:
    explicit InstanceHolder(LibLoader* loader);
    explicit InstanceHolder(LibLoader* loader, QScriptEngine* sEng);
    ~InstanceHolder();

    QString createUniqId() const;

public slots:
    QObject* getObject(const QString& id, const QString& className = "", const QString& libName = "");
    void destroyObject(const QString& id);
    void destroyAll();

private:
    QHash<QString, QObject*> objTable;
    LibLoader* loader;
    QScriptEngine* sEngine;

signals:

public slots:

};

#endif // INSTANCEHOLDER_H
